import App from './App'
import GoEasy from 'goeasy'




let moment = require('moment')

moment.locale('zh-cn')
Vue.prototype.$Time = moment
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif

Vue.prototype.GoEasy = GoEasy
let goeasy = GoEasy.getInstance({
    host:"hangzhou.goeasy.io",  //若是新加坡区域：singapore.goeasy.io
    appkey:"BC-b3ced4c51c5d499d9d90d3c9e23fdcac",
    modules:['pubsub']//根据需要，传入‘pubsub’或'im’，或数组方式同时传入
});
Vue.prototype.goEasy = goeasy


//建立连接
goeasy.connect({
	id:"test_channel", //pubsub选填，im必填，最大长度60字符
	// id:uni.getSystemInfoSync().deviceId, //pubsub选填，im必填，最大长度60字符
	data:{"avatar":"/www/xxx.png","nickname":"Neo"}, //必须是一个对象，pubsub选填，im必填，最大长度300字符，用于上下线提醒和查询在线用户列表时，扩展更多的属性
	onSuccess: function () {  //连接成功
	  console.log("连接成功") //连接成功
	},
	onFailed: function (error) { //连接失败
	  console.log("Failed to connect GoEasy, code:"+error.code+ ",error:"+error.content);
	},
	onProgress:function(attempts) { //连接或自动重连中
	  console.log("GoEasy is connecting", attempts);
	}
});